package com.a01_2021.thousandstimes.general.controller;

import com.a01_2021.thousandstimes.general.entity.EnglishComputer;
import com.a01_2021.thousandstimes.general.service.EnglishComputerService;
import com.a01_2021.thousandstimes.utils.AjaxResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @program: thousandstimes
 * @description:
 * @author: FRQ
 * @create: 2021-04-02 17:12
 **/
@RestController
@RequestMapping("/english-computer")
public class EnglishComputerController {

    @Autowired
    private EnglishComputerService englishComputerService;

    //用户添加英语和计算机证书
    @PreAuthorize("hasAuthority('english-computer-addEnglishComputer')")
    @DS("#header.instanceid")
    @PostMapping("addEnglishComputer")
    @ResponseBody
    public AjaxResponse addEnglishComputer(@RequestBody(required = false)EnglishComputer englishComputer) {
        return englishComputerService.insert(englishComputer);
    }
}
